package com.beauty.dressing.module.main.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.ViewGroup;

import com.beauty.dressing.common.bean.CourseBean;
import com.beauty.dressing.common.bean.GroupNavigation;
import com.beauty.dressing.common.bean.Video;
import com.beauty.dressing.module.common.adapter.CommonExpandWrapperAdapter;
import com.beauty.dressing.module.main.holder.CourseItemHolder;
import com.beauty.dressing.module.main.holder.GroupNavHolder;
import com.beauty.dressing.module.main.holder.VideoInListHolder;


/**
 * 电影列表适配器
 *
 * @author xutingz
 * @email：xutingzhen@pkebu.com
 */
public class VideoInListAdapter extends CommonExpandWrapperAdapter {

    public static class ViewType {
        public static final int VIDEO_LIST = 2;
    }

    public VideoInListAdapter(Context context) {
        super(context);
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
        super.onBindViewHolder(viewHolder, position);
    }

    @Override
    public int getItemViewType(int position) {
        Object o = getItem(position);
        if (o instanceof FixedViewInfo) {
            return ((FixedViewInfo) o).viewType;
        } else
        if (o instanceof Video){
            return ViewType.VIDEO_LIST;
        }
        return super.getItemViewType(position);
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
        if (isHeader(viewType) || isFooter(viewType)) {
            return super.onCreateViewHolder(viewGroup, viewType);
        } else
        if (viewType == ViewType.VIDEO_LIST){
            return new VideoInListHolder(mContext,mLayoutInflater,viewGroup);
        }
        return null;
    }

}
